package com.gsx.Controller;


import com.gsx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/admain")
public class LoginController {
    @Autowired
    private UserService userService;

    /*@PostMapping("/index")
    public String login(@RequestParam String username, @RequestParam String password,
    HttpSession httpSession, RedirectAttributes attributes){
        User user =userService.checkUser(username, password);
        if(username!=null&&password!=null){
            //防止密码传送到前端
            user.setPassword(null);
            httpSession.setAttribute("user",user);
            return "admain/index";
        }else{
            attributes.addFlashAttribute("message","用户名或密码错误");
            return "redirect:/admain";
        }
    }*/
    @GetMapping("/index")
    public String login(){
        return "admain/index";
    }

}
